﻿
namespace WCFRIAServices.Web
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;


    // Implements application logic using the TempDataEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class DomainService1 : LinqToEntitiesDomainService<TempDataEntities>
    {

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'tblOrg' query.
        public IQueryable<tblOrg> GetTblOrg()
        {
            return this.ObjectContext.tblOrg;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'tblRoute' query.
        public IQueryable<tblRoute> GetTblRoute()
        {
            return this.ObjectContext.tblRoute;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'tblRouteBus' query.
        public IQueryable<tblRouteBus> GetTblRouteBus()
        {
            return this.ObjectContext.tblRouteBus;
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'tblRouteD' query.
        public IQueryable<tblRouteD> GetTblRouteD()
        {
            return this.ObjectContext.tblRouteD;
        }

        public IQueryable<TreeClass> GetTreeClass()
        {
            return this.ObjectContext.TreeClass;
        }


        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="currentTreeClass">当前的东东</param>
        public void UpdateTreeClass(TreeClass currentTreeClass)
        {
            this.ObjectContext.TreeClass.AttachAsModified(currentTreeClass, this.ChangeSet.GetOriginal(currentTreeClass));
        }
    }
}


